/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import util.DatabaseUtil;


public class AdminDao {
    public Boolean Login(String id,String password){
        Connection con=null;
        PreparedStatement ps=null;
        ResultSet rs=null;
        try{
            con=DatabaseUtil.connect();
            ps=con.prepareStatement("select * from admin where id= ? and password= ?");
            ps.setString(1,id);
            ps.setString(2,password);
            rs=ps.executeQuery();
            if(rs.next()){
                return true;
            }
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            DatabaseUtil.closeConnection(con, ps, rs);
        }
        return false;
    }
}
